home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performBevel.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  17.2 KB  |  653 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  April 18, 1997
  22. //  Author:         ramesh 
  23. //
  24. //  Description:
  25. //      This script is defines the option box for the bevel surface menu item.
  26. //
  27. //  Input Arguments:
  28. //      int action
  29. //          0 - show the option box dialog
  30. //        1 - just execute the bevel operation
  31. //
  32. //  Return Value:
  33. //      None.
  34. //
  35.  
  36.  
  37. proc setOptionVars (int $forceFactorySettings)
  38. {
  39.     bevelSetOptionVars( $forceFactorySettings );
  40. }
  41.  
  42. global proc bevelVisibility()
  43. //  Description:
  44. //        Dim/show any bevel options as required by the number of edges
  45. //        to bevel.
  46. //
  47. {
  48.     int $nedges = 4;
  49.     int $val = `radioButtonGrp -q -select bevelTopBottomRadioOptions`;
  50.     if ( $val == 1 ) $nedges = 2;
  51.     else if ( $val == 2 ) $nedges = 3;
  52.     else if ( $val == 0 ) 
  53.     {
  54.         $val = `radioButtonGrp -q -select bevelBothOffRadioOptions`;
  55.         if( $val == 1 ) $nedges = 4;
  56.         else $nedges = 1;
  57.     }
  58.  
  59.     if ( $nedges == 1 )
  60.     {
  61.         // dim all the options for bevel so that extrude is only left
  62.         //
  63.         checkBoxGrp -e -en 0 bevelJoinSrfBox;
  64.         floatSliderGrp -e -en 0 bevelWidthFloatField;
  65.         floatSliderGrp -e -en 0 bevelDepthFloatField;
  66.         radioButtonGrp -e -en 0 bevelCornerRadioButtonGrp;
  67.         radioButtonGrp -e -en 0 bevelEdgesRadio;
  68.     }
  69.     else
  70.     {
  71.         // show all the options for bevel
  72.         //
  73.         checkBoxGrp -e -en 1 bevelJoinSrfBox;
  74.         floatSliderGrp -e -en 1 bevelWidthFloatField;
  75.         floatSliderGrp -e -en 1 bevelDepthFloatField;
  76.         radioButtonGrp -e -en 1 bevelCornerRadioButtonGrp;
  77.         radioButtonGrp -e -en 1 bevelEdgesRadio;
  78.     }
  79. }
  80.  
  81. proc createBevelUI( string $parent, int $inTheTool, string $goToTool )
  82. //
  83. //    Description :
  84. //        Bevel operation options
  85. //
  86. {
  87.     setParent $parent ;
  88.  
  89.     // layout for bevel options.
  90.     //
  91.     checkBoxGrp -ncb 1 -l "" -l1 "Attach Surfaces" -v1 on bevelJoinSrfBox;
  92.  
  93.     radioButtonGrp -nrb 2 -l "Bevel"
  94.         -l1 "Top Side" -da1 2
  95.         -l2 "Bottom Side" -da2 3
  96.         -cc "bevelVisibility"
  97.         bevelTopBottomRadioOptions;
  98.  
  99.     radioButtonGrp -nrb 2 -l "" -scl bevelTopBottomRadioOptions
  100.         -l1 "Both" -da1 4
  101.         -l2 "Off" -da2 1
  102.         -cc "bevelVisibility"
  103.         bevelBothOffRadioOptions;
  104.  
  105.     separator;
  106.  
  107.     floatSliderGrp -l "Bevel Width"
  108.         -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  109.         bevelWidthFloatField;
  110.     floatSliderGrp -l "Bevel Depth"
  111.         -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  112.         bevelDepthFloatField;
  113.     floatSliderGrp -l "Extrude Height"
  114.         -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  115.         extrudeDepthFloatField;
  116.  
  117.     radioButtonGrp -nrb 2 -select 1 -l "Bevel Corners"
  118.         -l1 "Straight" -da1 1
  119.         -l2 "Circular Arcs" -da2 2
  120.         bevelCornerRadioButtonGrp;
  121.  
  122.     radioButtonGrp -nrb 3
  123.         -l "Bevel Cap Edge"
  124.         -l1 "Convex"
  125.         -l2 "Concave"
  126.         -l3 "Straight"
  127.         bevelEdgesRadio;
  128.  
  129.     separator;
  130.  
  131.     // layout for add curve range, create as polygons.
  132.     //
  133.    radioButtonGrp -nrb 2 -l "Use Tolerance"
  134.        -l1 "Global"
  135.        -l2 "Local"
  136.        -on1 "tabLayout -e -selectTab noSlider useGlobalTolTab"
  137.        -on2 "tabLayout -e -selectTab showSlider useGlobalTolTab"
  138.        useGlobalTol;
  139.  
  140.    tabLayout -tabsVisible false useGlobalTolTab;
  141.        columnLayout showSlider;
  142.             floatSliderGrp -l "Tolerance"
  143.                  -min 0.00001 -max 1.0 -fmn 0.00001 -fmx 1000.0
  144.                 bevelToleranceFloatField;
  145.        setParent ..;
  146.        columnLayout noSlider;
  147.        setParent ..;
  148.    setParent ..;
  149.  
  150.    separator;
  151.  
  152.     radioButtonGrp -nrb 2 -label "Curve Range"
  153.         -label1 "Complete" -da1 0
  154.         -label2 "Partial" -da2 1 -select 1
  155.         curveRangeRadioButtonGrp;
  156.  
  157.     if( `isTrue "SubdivUIExists"` && `isTrue "SurfaceUIExists"` ) {
  158.         radioButtonGrp -nrb 4 -label "Output Geometry"
  159.           -label1 "Nurbs" -da1 0
  160.           -label2 "Polygons" -da2 1 -select 1
  161.           -label3 "Subdiv" -da3 1
  162.           -label4 "Bezier" -da4 1
  163.           -cc1 "tabLayout -e -st bevelPolyOptionsNo bevelPolyOptions"
  164.           -cc2 "tabLayout -e -st bevelPolyOptionsOK bevelPolyOptions"
  165.           -cc3 "tabLayout -e -st bevelPolyOptionsSubdiv bevelPolyOptions"
  166.           -cc4 "tabLayout -e -st bevelPolyOptionsBezier bevelPolyOptions"
  167.           outputPolyRadioButtonGrp;
  168.     }
  169.     else if( `isTrue "SurfaceUIExists"` ) {
  170.         radioButtonGrp -nrb 3 -label "Output Geometry"
  171.           -label1 "Nurbs" -da1 0
  172.           -label2 "Polygons" -da2 1 -select 1
  173.           -label3 "Bezier" -da3 1
  174.           -cc1 "tabLayout -e -st bevelPolyOptionsNo bevelPolyOptions"
  175.           -cc2 "tabLayout -e -st bevelPolyOptionsOK bevelPolyOptions"
  176.           -cc3 "tabLayout -e -st bevelPolyOptionsBezier bevelPolyOptions"
  177.           outputPolyRadioButtonGrp;
  178.     }
  179.  
  180.     separator;
  181.  
  182.     tabLayout -tabsVisible false bevelPolyOptions;
  183.       string $par = `columnLayout bevelPolyOptionsOK`;
  184.         nurbsToPolyAddOptions $par;
  185.       setParent ..;
  186.       columnLayout bevelPolyOptionsNo;
  187.       setParent ..;
  188.       columnLayout bevelPolyOptionsSubdiv;
  189.         nurbsToSubdivAddOptions $par;
  190.       setParent ..;
  191.       columnLayout bevelPolyOptionsBezier;
  192.       setParent ..;
  193.     setParent ..;
  194.  
  195.     if( $inTheTool ) {
  196.         separator;
  197.         checkBoxGrp -ncb 2 -l "Tool Behavior"
  198.           -l1 "Exit on Completion"
  199.           -v1 off
  200.           -on1 ("scriptCtx -e -euc true " + $goToTool)
  201.           -of1 ("scriptCtx -e -euc false " + $goToTool)
  202.  
  203.           -l2 "Auto Completion"
  204.           -v2 on
  205.           -on2 ("scriptCtx -e -lac true " + $goToTool)
  206.           -of2 ("scriptCtx -e -lac false " + $goToTool)
  207.           scriptToolExtraWidget;
  208.     }
  209. }
  210.  
  211. proc string assembleCmd()
  212. //
  213. //    Description :
  214. //        To assemble bevel proc.
  215. //
  216. {
  217.     setOptionVars(false);
  218.     string $cmd = "bevelPreset"  ;
  219.     $cmd = $cmd + "(" ;  
  220.  
  221.     int $history = `constructionHistory -q -tgl`;
  222.     $cmd = $cmd + $history ;  
  223.     $cmd = $cmd + "," ;  
  224.  
  225.     int $curveRangePartial = `optionVar -q bevelCurveRangePartial` ;
  226.     $cmd = $cmd + $curveRangePartial ;  
  227.     $cmd = $cmd + "," ;  
  228.  
  229.     int $polygons = `optionVar -q bevelOutputPolygons` ;
  230.     if( !`isTrue "SurfaceUIExists"` ) $polygons = 1;
  231.     $cmd = $cmd + $polygons ;  
  232.     $cmd = $cmd + "," ;  
  233.  
  234.     float $tol = `optionVar -q bevelTolerance` ;
  235.     if( `optionVar -q bevelUseGlobalTol` ) {
  236.         $tol = `optionVar -q positionalTolerance`;
  237.     }
  238.     $cmd = $cmd + $tol ;  
  239.     $cmd = $cmd + "," ;
  240.   
  241.     int $bevelJoin = `optionVar -q bevelAttachSurfaces` ;
  242.     $cmd = $cmd + $bevelJoin ;  
  243.     $cmd = $cmd + "," ;  
  244.  
  245.     int $bevelSides = `optionVar -q bevelNSides` ;
  246.     $cmd = $cmd + $bevelSides ;  
  247.     $cmd = $cmd + "," ;  
  248.  
  249.     float $bevelWidth = `optionVar -q bevelWidth` ;
  250.     $cmd = $cmd + $bevelWidth ;  
  251.     $cmd = $cmd + "," ;  
  252.  
  253.     float $bevelDepth = `optionVar -q bevelDepth` ;
  254.     $cmd = $cmd + $bevelDepth ;
  255.     $cmd = $cmd + "," ;  
  256.  
  257.     float $bevelExtrudeHt = `optionVar -q bevelExtrudeHeight` ;
  258.     $cmd = $cmd + $bevelExtrudeHt ;  
  259.     $cmd = $cmd + "," ;  
  260.  
  261.     int $bevelCorner = `optionVar -q bevelCorner` ;
  262.     $cmd = $cmd + $bevelCorner ;  
  263.     $cmd = $cmd + "," ;  
  264.  
  265.     int $bevelCapEdge = `optionVar -q bevelCapEdge` ;
  266.     $cmd = $cmd + $bevelCapEdge ;  
  267.     $cmd = $cmd + ")" ;  
  268.  
  269.     return $cmd ;
  270. }
  271.  
  272. proc bevelOptions( int $inTheTool, string $goToTool )
  273. {
  274.     //    Name of the command for this option box.
  275.     //
  276.     string $commandName = "bevel";
  277.  
  278.     //    Build the option box actions.
  279.     //
  280.     string $callback = ($commandName + "Callback");
  281.     string $setup = ($commandName + "Setup");
  282.  
  283.     global string $gOptionBoxActionToolItem;
  284.     $gOptionBoxActionToolItem = "modelWithToolBevel";
  285.     global string $gOptionBoxActionToolItemCB;
  286.     $gOptionBoxActionToolItemCB = "bevelToolScript 3";
  287.  
  288.     //    Step 1:  Get the option box.
  289.     //    ============================
  290.     string $layout = getOptionBox();
  291.     setParent $layout;
  292.     
  293.     //    Step 2:  Pass the command name to the option box.
  294.     //    =================================================
  295.     setOptionBoxCommandName($commandName);
  296.     
  297.     //    Step 3:  Activate the default UI template.
  298.     //    ==========================================
  299.     setUITemplate -pushTemplate DefaultTemplate;
  300.  
  301.     //    Step 4: Create option box contents.
  302.     //    ===================================
  303.     
  304.     //    Turn on the wait cursor.
  305.     //
  306.     waitCursor -state 1;
  307.  
  308.     tabLayout -scr true -tv false;
  309.     
  310.     string $parent = `columnLayout -adjustableColumn 1`;
  311.     
  312.     createBevelUI( $parent, $inTheTool, $goToTool );
  313.  
  314.     //    Turn off the wait cursor.
  315.     //
  316.     waitCursor -state 0;
  317.     
  318.     //    Step 5: Deactivate the default UI template.
  319.     //  ===========================================
  320.     //
  321.     setUITemplate -popTemplate;
  322.  
  323.     //    Step 6: Customize the buttons.  
  324.     //    ==============================
  325.  
  326.     //    'Apply' button.
  327.     //
  328.     string $applyBtn = getOptionBoxApplyBtn();
  329.     if( $inTheTool ) {
  330.         button -edit -l "Bevel Tool"
  331.           -command ($callback + " " + $parent + " 3 \"" + $goToTool + "\"")
  332.           $applyBtn;
  333.     }
  334.     else {
  335.         button -edit -l "Bevel"
  336.           -command ($callback + " " + $parent + " 1 \"" + $goToTool + "\"")
  337.           $applyBtn;
  338.     }
  339.  
  340.     //    'Save' button.
  341.     //
  342.     string $saveBtn = getOptionBoxSaveBtn();
  343.     button -edit 
  344.         -command ($callback + " " + $parent + " 0 \"" +
  345.                   $goToTool + "\"; hideOptionBox")
  346.         $saveBtn;
  347.  
  348.     //    'Reset' button.
  349.     //
  350.     string $resetBtn = getOptionBoxResetBtn();
  351.     button -edit 
  352.         -command ($setup + " " + $parent + " 1 \"" + $goToTool + "\"")
  353.         $resetBtn;
  354.  
  355.     //    Step 7: Set the option box title.
  356.     //    =================================
  357.     //
  358.     if( $inTheTool ) {
  359.         setOptionBoxTitle("Bevel Tool Options");
  360.     }
  361.     else {
  362.         setOptionBoxTitle("Bevel Options");
  363.     }
  364.  
  365.     //    Step 8: Customize the 'Help' menu item text.
  366.     //    ============================================
  367.     //
  368.     setOptionBoxHelpTag( "Bevel" );
  369.  
  370.     //    Step 9: Set the current values of the option box.
  371.     //    =================================================
  372.     //
  373.     eval ($setup + " " + $parent + " 0 \"" + $goToTool + "\"");    
  374.     
  375.     //    Step 10: Show the option box.
  376.     //    =============================
  377.     //
  378.     showOptionBox();
  379. }
  380.  
  381. proc string bevelHelp()
  382. {
  383.     string $cmdHelp = "Command: Bevel - creates a bevelled surface. \n " ;
  384.     string $selectHelp = "Selection: Select a curve or surface isoparm or curve on surface to bevel " ;
  385.     return $cmdHelp+$selectHelp ;
  386. }
  387.  
  388. global proc bevelSetup( string $parent,
  389.                         int $forceFactorySettings,
  390.                         string $goToTool)
  391. {
  392.     // retrieve option settings.
  393.     //
  394.     setOptionVars($forceFactorySettings);    
  395.     bevelToolSetup( $forceFactorySettings, $goToTool );
  396.  
  397.     setParent $parent;    
  398.  
  399.     // query and set controls for all the option vars.
  400.     //
  401.     float $bwidth = `optionVar -q bevelWidth` ;
  402.     floatSliderGrp -e -v $bwidth bevelWidthFloatField ;
  403.     if( $forceFactorySettings ) {
  404.         floatSliderGrp -e
  405.             -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  406.             bevelWidthFloatField ;
  407.     }
  408.  
  409.     // bevel depth.
  410.     //
  411.     float $bdepth = `optionVar -q bevelDepth` ;
  412.     floatSliderGrp -e -v $bdepth bevelDepthFloatField ;
  413.     if( $forceFactorySettings ) {
  414.         floatSliderGrp -e
  415.             -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  416.             bevelDepthFloatField;
  417.     }
  418.  
  419.     // extrude height.
  420.     //
  421.     float $edepth = `optionVar -q bevelExtrudeHeight` ;
  422.     floatSliderGrp -e -v $edepth extrudeDepthFloatField ;
  423.     if( $forceFactorySettings ) {
  424.         floatSliderGrp -e
  425.             -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0
  426.             extrudeDepthFloatField;
  427.     }
  428.  
  429.     // global vs. local tolerance.
  430.     int $useGlobalTol = `optionVar -q bevelUseGlobalTol`;
  431.     radioButtonGrp -e -select (2 - $useGlobalTol) useGlobalTol;
  432.  
  433.     // bevel tolerance.
  434.     //
  435.     float $tol = `optionVar -q bevelTolerance` ;
  436.     floatSliderGrp -e -v $tol bevelToleranceFloatField ;
  437.     if( $forceFactorySettings ) {
  438.         floatSliderGrp -e
  439.             -min 0.00001 -max 1.0 -fmn 0.00001 -fmx 1000.0
  440.             bevelToleranceFloatField;
  441.     }
  442.  
  443.     if( $useGlobalTol == 1 ) {
  444.         tabLayout -e -selectTab noSlider useGlobalTolTab;
  445.     }
  446.     else {
  447.         tabLayout -e -selectTab showSlider useGlobalTolTab;
  448.     }
  449.  
  450.     // attach the surfaces.
  451.     //
  452.     int $attach = `optionVar -q bevelAttachSurfaces` ;
  453.  
  454.     if( $attach == 1 ) {
  455.         checkBoxGrp -edit -v1 true bevelJoinSrfBox  ;
  456.     } else {
  457.         checkBoxGrp -edit -v1 0 bevelJoinSrfBox  ;
  458.     }
  459.  
  460.     // bevel corner.
  461.     //
  462.     int $bcorner = `optionVar -q bevelCorner`;
  463.     radioButtonGrp -edit -select $bcorner bevelCornerRadioButtonGrp ;        
  464.     
  465.     // cap.
  466.     //    
  467.     int $bcap = `optionVar -q bevelCapEdge` ;
  468.  
  469.     if( $bcap == 1 ) {
  470.         radioButtonGrp -edit -select 3 bevelEdgesRadio ;
  471.     }
  472.     else {
  473.         radioButtonGrp -edit -select ($bcap-1) bevelEdgesRadio ;
  474.     }
  475.  
  476.     // curve range on bevel inputs.
  477.     //
  478.     int $curveRangePartial = `optionVar -q bevelCurveRangePartial`+1 ;
  479.     radioButtonGrp -edit -select $curveRangePartial curveRangeRadioButtonGrp ;
  480.  
  481.     // polygon output.
  482.     //
  483.     int $polygons = `optionVar -q bevelOutputPolygons`;
  484.     if( `isTrue "SurfaceUIExists"` ) {
  485.         if( `isTrue "SubdivUIExists"` && (3 != $polygons)) {
  486.             radioButtonGrp -edit -select ($polygons+1)
  487.                 outputPolyRadioButtonGrp;
  488.         }
  489.         else {
  490.             radioButtonGrp -edit -select 3 outputPolyRadioButtonGrp;
  491.         }
  492.     }
  493.     else {
  494.         $polygons = 1;
  495.     }
  496.  
  497.     int $nedges = `optionVar -q bevelNSides` ;
  498.     
  499.     if( $nedges == 1 ) {
  500.         int $ne = 2 ;
  501.         radioButtonGrp -edit -select $ne bevelBothOffRadioOptions ;
  502.     } else if( $nedges == 4 ) {
  503.         int $ne = 1 ;
  504.         radioButtonGrp -edit -select $ne bevelBothOffRadioOptions ;
  505.     } else if( $nedges == 3 ) {
  506.         int $ne = 2 ;
  507.         radioButtonGrp -edit -select $ne bevelTopBottomRadioOptions ;
  508.     } else if( $nedges == 2 ) {
  509.         int $ne = 1 ;
  510.         radioButtonGrp -edit -select $ne bevelTopBottomRadioOptions ;
  511.     }
  512.  
  513.     // dim/show any options as required
  514.     //
  515.     bevelVisibility();
  516.  
  517.     switch( $polygons ) {
  518.       case 0:
  519.       default:
  520.         tabLayout -e -st bevelPolyOptionsNo bevelPolyOptions;
  521.         break;
  522.       case 1:
  523.         tabLayout -e -st bevelPolyOptionsOK bevelPolyOptions;
  524.         break;
  525.       case 2:
  526.         tabLayout -e -st bevelPolyOptionsSubdiv bevelPolyOptions;
  527.         break;
  528.     }
  529.  
  530.     if( "" != $goToTool ) { 
  531.         checkBoxGrp -e -v1 `scriptCtx -q -euc $goToTool`
  532.           scriptToolExtraWidget;
  533.         checkBoxGrp -e -v2 `scriptCtx -q -lac $goToTool`
  534.           scriptToolExtraWidget;
  535.     }
  536.  
  537.     nurbsToPolySetup( $parent, $forceFactorySettings );
  538.     nurbsToSubdivSetup( $parent, $forceFactorySettings );
  539. }
  540.  
  541. global proc bevelCallback( string $parent, int $doIt, string $goToTool )
  542. {
  543.     if( "" != $goToTool ) {
  544.         optionVar -iv bevelEuc `scriptCtx -q -euc $goToTool`;
  545.         optionVar -iv bevelLac `scriptCtx -q -lac $goToTool`;
  546.     }
  547.  
  548.     setParent $parent ;
  549.  
  550.     // get Values from controls.
  551.     //
  552.     int $curveRangePartial = `radioButtonGrp -q -select curveRangeRadioButtonGrp` - 1 ;
  553.     optionVar -intValue bevelCurveRangePartial $curveRangePartial ;
  554.  
  555.     if( `isTrue "SurfaceUIExists"` ) {
  556.         int $polys = `radioButtonGrp -q -select outputPolyRadioButtonGrp`;
  557.         if( (3 == $polys) && ! `isTrue "SubdivUIExists"` ) {
  558.             $polys = 4;
  559.         }
  560.         optionVar -intValue bevelOutputPolygons ($polys-1) ;
  561.     }
  562.  
  563.     // global vs. local
  564.     int $useGlobalTol = 2 - `radioButtonGrp -q -select useGlobalTol`;
  565.     optionVar -intValue bevelUseGlobalTol $useGlobalTol;
  566.  
  567.     float $value = `floatSliderGrp -q -v bevelToleranceFloatField` ;
  568.     optionVar -floatValue bevelTolerance $value ;
  569.  
  570.     $value = `floatSliderGrp -q -v bevelWidthFloatField` ;
  571.     optionVar -floatValue bevelWidth $value ;
  572.  
  573.     $value = `floatSliderGrp -q -v bevelDepthFloatField` ;
  574.     optionVar -floatValue bevelDepth $value ;
  575.  
  576.     $value = `floatSliderGrp -q -v extrudeDepthFloatField` ;
  577.     optionVar -floatValue bevelExtrudeHeight $value ;
  578.  
  579.     // attach surfaces or not.
  580.     //
  581.     int $val = `checkBoxGrp -q -v1 bevelJoinSrfBox` ;
  582.     optionVar -intValue bevelAttachSurfaces $val ;
  583.  
  584.     // bevel corner type.
  585.     //
  586.     $val = `radioButtonGrp -q -select bevelCornerRadioButtonGrp` ;
  587.     optionVar -intValue bevelCorner $val ;
  588.  
  589.     // bevel number of edges.
  590.     //
  591.     int $ne = 4 ;
  592.     $val = `radioButtonGrp -q -select bevelTopBottomRadioOptions` ;
  593.     if( $val == 1 ) $ne = 2 ;
  594.     else if( $val == 2 ) $ne = 3 ;
  595.     else if( $val == 0 ) {
  596.         $val = `radioButtonGrp -q -select bevelBothOffRadioOptions` ;
  597.         if( $val == 1 ) $ne = 4 ;
  598.         else $ne = 1 ;
  599.     }
  600.     optionVar -intValue bevelNSides $ne ;
  601.  
  602.     int $nb = 1;
  603.     $val = `radioButtonGrp -q -select bevelEdgesRadio`;
  604.     if( $val < 3 ) {
  605.         $nb = $val + 1;
  606.     }
  607.     optionVar -intValue bevelCapEdge $nb ;
  608.  
  609.     nurbsToPolyCallback( $parent, 0 );
  610.     nurbsToSubdivCallback( $parent, 0 );
  611.  
  612.     if( 1 == $doIt ) {
  613.         performBevel(0, $goToTool); 
  614.         string $tmpCmd = "performBevel(0, \"" + $goToTool + "\")";
  615.         addToRecentCommandQueue $tmpCmd "Bevel";
  616.     }
  617.     else if( $doIt ) {
  618.         setToolTo $goToTool;
  619.     }
  620. }
  621.  
  622. global proc string performBevel( int $action, string $goToTool )
  623. //
  624. //    Description :
  625. //        $action = 0 ==> do the command.
  626. //        $action = 1 ==>show option box.
  627. //        $action = 2 ==>drag to shelf.
  628. //        $action = 3 ==>Show the tool option box
  629. {
  630.     int $inTheTool = false;
  631.     if( 3 == $action ) {
  632.         $action = 1;
  633.         $inTheTool = true;
  634.     }
  635.  
  636.     string $cmd = "" ;
  637.     switch( $action ) {
  638.       case 0:
  639.         $cmd = `assembleCmd` ;
  640.         eval $cmd ;
  641.         break ;
  642.       case 1:
  643.         bevelOptions( $inTheTool, $goToTool );
  644.         break ;
  645.       case 2:
  646.       default:
  647.         $cmd = `assembleCmd` ;
  648.         break ;
  649.     }
  650.     return $cmd ;
  651. }
  652.  
  653.